package com.bjl.controller;

import com.alibaba.fastjson.JSONObject;
import com.bjl.service.LotteryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import orm.base.Ex.BaseControllerEx;

import java.util.Map;

/**
 * Created by ashin on 2017/12/8.
 */
@Controller
@Scope("prototype")
@RequestMapping("lottery")
public class LotteryController extends BaseControllerEx {

    @Autowired
    LotteryService lotteryService;

    @Override
    protected void init() {
        super.init(lotteryService);
    }

    @Override
    protected JSONObject doInsert(@RequestParam Map<String, Object> map) throws Exception {
        return lotteryService.insertp(map, session, request);
    }

    /**
     * 查询房间历史战绩
     * @param map
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/doQueryPastLotteryInfo", method = RequestMethod.POST)
    public JSONObject doQueryPastLotteryInfo(@RequestParam Map map) throws Exception {
        return lotteryService.queryPastLotteryInfo(map,session);
    }

    /**
     * 获得开奖时间
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/doGetOpenTime", method = RequestMethod.POST)
    public JSONObject doGetOpenTime(@RequestParam Map map) throws Exception{
        return lotteryService.getOpenTime(map,session);
    }
}
